﻿using System;
using MoonSharp.Interpreter;
using UnityEngine;

namespace Lua
{
	// Token: 0x020002FF RID: 767
	[MoonSharpUserData]
	public class Transform
	{
		// Token: 0x06001309 RID: 4873 RVA: 0x000821FA File Offset: 0x000803FA
		[MoonSharpHidden]
		public Transform(Transform transform)
		{
			if (transform == null)
			{
				Debug.LogError("Creating empty transform");
			}
			this._tf = transform;
		}

		// Token: 0x0600130A RID: 4874 RVA: 0x0008221F File Offset: 0x0008041F
		private Transform GetTransform(Transform unityTransform)
		{
			if (unityTransform == null)
			{
				return null;
			}
			return new Transform(unityTransform);
		}

		// Token: 0x170002F2 RID: 754
		// (get) Token: 0x0600130B RID: 4875 RVA: 0x00082235 File Offset: 0x00080435
		public int childCount
		{
			get
			{
				return this._tf.childCount;
			}
		}

		// Token: 0x170002F3 RID: 755
		// (get) Token: 0x0600130C RID: 4876 RVA: 0x00082242 File Offset: 0x00080442
		// (set) Token: 0x0600130D RID: 4877 RVA: 0x00082254 File Offset: 0x00080454
		public Vector3 eulerAngles
		{
			get
			{
				return new Vector3(this._tf.eulerAngles);
			}
			set
			{
				this._tf.eulerAngles = value.vector3;
			}
		}

		// Token: 0x170002F4 RID: 756
		// (get) Token: 0x0600130E RID: 4878 RVA: 0x00082267 File Offset: 0x00080467
		// (set) Token: 0x0600130F RID: 4879 RVA: 0x00082279 File Offset: 0x00080479
		public Vector3 forward
		{
			get
			{
				return new Vector3(this._tf.forward);
			}
			set
			{
				this._tf.forward = value.vector3;
			}
		}

		// Token: 0x170002F5 RID: 757
		// (get) Token: 0x06001310 RID: 4880 RVA: 0x0008228C File Offset: 0x0008048C
		// (set) Token: 0x06001311 RID: 4881 RVA: 0x0008229E File Offset: 0x0008049E
		public Vector3 localEulerAngles
		{
			get
			{
				return new Vector3(this._tf.localEulerAngles);
			}
			set
			{
				this._tf.localEulerAngles = value.vector3;
			}
		}

		// Token: 0x170002F6 RID: 758
		// (get) Token: 0x06001312 RID: 4882 RVA: 0x000822B1 File Offset: 0x000804B1
		// (set) Token: 0x06001313 RID: 4883 RVA: 0x000822C3 File Offset: 0x000804C3
		public Vector3 localPosition
		{
			get
			{
				return new Vector3(this._tf.localPosition);
			}
			set
			{
				this._tf.localPosition = value.vector3;
			}
		}

		// Token: 0x170002F7 RID: 759
		// (get) Token: 0x06001314 RID: 4884 RVA: 0x000822D6 File Offset: 0x000804D6
		// (set) Token: 0x06001315 RID: 4885 RVA: 0x000822E8 File Offset: 0x000804E8
		public Quaternion localRotation
		{
			get
			{
				return new Quaternion(this._tf.localRotation);
			}
			set
			{
				this._tf.localRotation = value.quaternion;
			}
		}

		// Token: 0x170002F8 RID: 760
		// (get) Token: 0x06001316 RID: 4886 RVA: 0x000822FB File Offset: 0x000804FB
		// (set) Token: 0x06001317 RID: 4887 RVA: 0x0008230D File Offset: 0x0008050D
		public Vector3 localScale
		{
			get
			{
				return new Vector3(this._tf.localScale);
			}
			set
			{
				this._tf.localScale = value.vector3;
			}
		}

		// Token: 0x170002F9 RID: 761
		// (get) Token: 0x06001318 RID: 4888 RVA: 0x00082320 File Offset: 0x00080520
		public Vector3 lossyScale
		{
			get
			{
				return new Vector3(this._tf.lossyScale);
			}
		}

		// Token: 0x170002FA RID: 762
		// (get) Token: 0x06001319 RID: 4889 RVA: 0x00082332 File Offset: 0x00080532
		// (set) Token: 0x0600131A RID: 4890 RVA: 0x0008233F File Offset: 0x0008053F
		public string name
		{
			get
			{
				return this._tf.name;
			}
			set
			{
				this._tf.name = value;
			}
		}

		// Token: 0x170002FB RID: 763
		// (get) Token: 0x0600131B RID: 4891 RVA: 0x0008234D File Offset: 0x0008054D
		public Transform parent
		{
			get
			{
				return (!(this._tf != null)) ? null : this.GetTransform(this._tf.parent);
			}
		}

		// Token: 0x170002FC RID: 764
		// (get) Token: 0x0600131C RID: 4892 RVA: 0x00082378 File Offset: 0x00080578
		public Entity entity
		{
			get
			{
				Transform transform = this._tf;
				while (!transform.GetComponent<EntityBase>())
				{
					transform = transform.parent;
				}
				return transform.GetComponent<EntityBase>().GetLuaEntity();
			}
		}

		// Token: 0x170002FD RID: 765
		// (get) Token: 0x0600131D RID: 4893 RVA: 0x000823B3 File Offset: 0x000805B3
		// (set) Token: 0x0600131E RID: 4894 RVA: 0x000823CA File Offset: 0x000805CA
		public Vector3 position
		{
			get
			{
				return new Vector3(this._tf.position.ToVirtual());
			}
			set
			{
				this._tf.position = value.vector3.ToWorld();
			}
		}

		// Token: 0x170002FE RID: 766
		// (get) Token: 0x0600131F RID: 4895 RVA: 0x000823E2 File Offset: 0x000805E2
		// (set) Token: 0x06001320 RID: 4896 RVA: 0x000823F4 File Offset: 0x000805F4
		public Vector3 right
		{
			get
			{
				return new Vector3(this._tf.right);
			}
			set
			{
				this._tf.right = value.vector3;
			}
		}

		// Token: 0x170002FF RID: 767
		// (get) Token: 0x06001321 RID: 4897 RVA: 0x00082407 File Offset: 0x00080607
		public Transform root
		{
			get
			{
				return this.GetTransform(this._tf.root);
			}
		}

		// Token: 0x17000300 RID: 768
		// (get) Token: 0x06001322 RID: 4898 RVA: 0x0008241A File Offset: 0x0008061A
		// (set) Token: 0x06001323 RID: 4899 RVA: 0x0008242C File Offset: 0x0008062C
		public Quaternion rotation
		{
			get
			{
				return new Quaternion(this._tf.rotation);
			}
			set
			{
				this._tf.rotation = value.quaternion;
			}
		}

		// Token: 0x17000301 RID: 769
		// (get) Token: 0x06001324 RID: 4900 RVA: 0x0008243F File Offset: 0x0008063F
		// (set) Token: 0x06001325 RID: 4901 RVA: 0x00082451 File Offset: 0x00080651
		public Vector3 up
		{
			get
			{
				return new Vector3(this._tf.up);
			}
			set
			{
				this._tf.up = value.vector3;
			}
		}

		// Token: 0x06001326 RID: 4902 RVA: 0x00082464 File Offset: 0x00080664
		public void DetachChildren()
		{
			this._tf.DetachChildren();
		}

		// Token: 0x06001327 RID: 4903 RVA: 0x00082471 File Offset: 0x00080671
		public Transform Find(string name)
		{
			return this.GetTransform(this._tf.Find(name));
		}

		// Token: 0x06001328 RID: 4904 RVA: 0x00082485 File Offset: 0x00080685
		public Transform GetChild(int index)
		{
			return this.GetTransform(this._tf.GetChild(index));
		}

		// Token: 0x06001329 RID: 4905 RVA: 0x00082499 File Offset: 0x00080699
		public int GetSiblingIndex()
		{
			return this._tf.GetSiblingIndex();
		}

		// Token: 0x0600132A RID: 4906 RVA: 0x000824A6 File Offset: 0x000806A6
		public Vector3 InverseTransformDirection(Vector3 direction)
		{
			return new Vector3(this._tf.InverseTransformDirection(direction.vector3));
		}

		// Token: 0x0600132B RID: 4907 RVA: 0x000824BE File Offset: 0x000806BE
		public Vector3 InverseTransformDirection(float x, float y, float z)
		{
			return new Vector3(this._tf.InverseTransformDirection(x, y, z));
		}

		// Token: 0x0600132C RID: 4908 RVA: 0x000824D4 File Offset: 0x000806D4
		public Vector3 InverseTransformPoint(Vector3 direction)
		{
			Vector3 position = direction.vector3.ToWorld();
			return new Vector3(this._tf.InverseTransformPoint(position));
		}

		// Token: 0x0600132D RID: 4909 RVA: 0x000824FE File Offset: 0x000806FE
		public Vector3 InverseTransformPoint(float x, float y, float z)
		{
			return this.InverseTransformPoint(Vector3.New(x, y, z));
		}

		// Token: 0x0600132E RID: 4910 RVA: 0x0008250E File Offset: 0x0008070E
		public Vector3 InverseTransformVector(Vector3 direction)
		{
			return new Vector3(this._tf.InverseTransformVector(direction.vector3));
		}

		// Token: 0x0600132F RID: 4911 RVA: 0x00082526 File Offset: 0x00080726
		public Vector3 InverseTransformVector(float x, float y, float z)
		{
			return new Vector3(this._tf.InverseTransformVector(x, y, z));
		}

		// Token: 0x06001330 RID: 4912 RVA: 0x0008253B File Offset: 0x0008073B
		public bool IsChildOf(Transform parent)
		{
			return parent != null && this._tf.IsChildOf(parent._tf);
		}

		// Token: 0x06001331 RID: 4913 RVA: 0x00082557 File Offset: 0x00080757
		public void LookAt(Transform target)
		{
			if (target != null)
			{
				this._tf.LookAt(target._tf);
			}
			else
			{
				Debug.LogError("target is nil");
			}
		}

		// Token: 0x06001332 RID: 4914 RVA: 0x0008257F File Offset: 0x0008077F
		public void LookAt(Transform target, Vector3 worldUp)
		{
			if (target != null)
			{
				this._tf.LookAt(target._tf, worldUp.vector3);
			}
			else
			{
				Debug.LogError("target is nil");
			}
		}

		// Token: 0x06001333 RID: 4915 RVA: 0x000825AD File Offset: 0x000807AD
		public void LookAt(Vector3 worldPosition)
		{
			this._tf.LookAt(worldPosition.vector3);
		}

		// Token: 0x06001334 RID: 4916 RVA: 0x000825C0 File Offset: 0x000807C0
		public void LookAt(Vector3 worldPosition, Vector3 worldUp)
		{
			this._tf.LookAt(worldPosition.vector3, worldUp.vector3);
		}

		// Token: 0x06001335 RID: 4917 RVA: 0x000825D9 File Offset: 0x000807D9
		public void Rotate(Vector3 eulerAngles)
		{
			this._tf.Rotate(eulerAngles.vector3);
		}

		// Token: 0x06001336 RID: 4918 RVA: 0x000825EC File Offset: 0x000807EC
		public void Rotate(float xAngle, float yAngle, float zAngle)
		{
			this._tf.Rotate(xAngle, yAngle, zAngle);
		}

		// Token: 0x06001337 RID: 4919 RVA: 0x000825FC File Offset: 0x000807FC
		public void Rotate(Vector3 axis, float angle)
		{
			this._tf.Rotate(axis.vector3, angle);
		}

		// Token: 0x06001338 RID: 4920 RVA: 0x00082610 File Offset: 0x00080810
		public void Rotate(Vector3 point, Vector3 axis, float angle)
		{
			this._tf.RotateAround(point.vector3, axis.vector3, angle);
		}

		// Token: 0x06001339 RID: 4921 RVA: 0x0008262A File Offset: 0x0008082A
		public void SetParent(Transform parent)
		{
			if (parent != null)
			{
				this._tf.SetParent(parent._tf);
			}
			else
			{
				this._tf.parent = null;
			}
		}

		// Token: 0x0600133A RID: 4922 RVA: 0x00082654 File Offset: 0x00080854
		public void SetParent(Transform parent, bool worldPositionStays)
		{
			if (parent != null)
			{
				this._tf.SetParent(parent._tf, worldPositionStays);
			}
			else
			{
				this._tf.parent = null;
			}
		}

		// Token: 0x0600133B RID: 4923 RVA: 0x0008267F File Offset: 0x0008087F
		public Vector3 TransformDirection(Vector3 direction)
		{
			return new Vector3(this._tf.TransformDirection(direction.vector3));
		}

		// Token: 0x0600133C RID: 4924 RVA: 0x00082697 File Offset: 0x00080897
		public Vector3 TransformDirection(float x, float y, float z)
		{
			return new Vector3(this._tf.TransformDirection(x, y, z));
		}

		// Token: 0x0600133D RID: 4925 RVA: 0x000826AC File Offset: 0x000808AC
		public Vector3 TransformPoint(Vector3 direction)
		{
			Vector3 vector = this._tf.TransformPoint(direction.vector3);
			return new Vector3(vector.ToVirtual());
		}

		// Token: 0x0600133E RID: 4926 RVA: 0x000826D6 File Offset: 0x000808D6
		public Vector3 TransformPoint(float x, float y, float z)
		{
			return this.TransformPoint(Vector3.New(x, y, z));
		}

		// Token: 0x0600133F RID: 4927 RVA: 0x000826E6 File Offset: 0x000808E6
		public Vector3 TransformVector(Vector3 direction)
		{
			return new Vector3(this._tf.TransformVector(direction.vector3));
		}

		// Token: 0x06001340 RID: 4928 RVA: 0x000826FE File Offset: 0x000808FE
		public Vector3 TransformVector(float x, float y, float z)
		{
			return new Vector3(this._tf.TransformVector(x, y, z));
		}

		// Token: 0x06001341 RID: 4929 RVA: 0x00082713 File Offset: 0x00080913
		public void Translate(Vector3 translation)
		{
			this._tf.Translate(translation.vector3);
		}

		// Token: 0x06001342 RID: 4930 RVA: 0x00082726 File Offset: 0x00080926
		public void Translate(float x, float y, float z)
		{
			this._tf.Translate(x, y, z);
		}

		// Token: 0x06001343 RID: 4931 RVA: 0x00082736 File Offset: 0x00080936
		public void Translate(Vector3 translation, Transform relativeTo)
		{
			if (relativeTo != null)
			{
				this._tf.Translate(translation.vector3, relativeTo._tf);
			}
			else
			{
				Debug.LogError("relativeTo is nil");
			}
		}

		// Token: 0x06001344 RID: 4932 RVA: 0x00082764 File Offset: 0x00080964
		public void Translate(float x, float y, float z, Transform relativeTo)
		{
			if (relativeTo != null)
			{
				this._tf.Translate(x, y, z, relativeTo._tf);
			}
			else
			{
				Debug.LogError("relativeTo is nil");
			}
		}

		// Token: 0x06001345 RID: 4933 RVA: 0x00082791 File Offset: 0x00080991
		[MoonSharpUserDataMetamethod("__eq")]
		public static bool Equals(Transform a, Transform b)
		{
			return (a == null && b == null) || (a != null && b != null && a._tf == b._tf);
		}

		// Token: 0x040016DA RID: 5850
		[MoonSharpHidden]
		public Transform _tf;
	}
}
